{% extends "base.html" %}

{% block title %}登录 - 万岛潜水{% endblock %}

{% block content %}
<div class="container mt-5">
    <div class="row justify-content-center">
        <div class="col-md-6">
            <div class="card">
                <div class="card-header bg-primary text-white">
                    <h4 class="mb-0">用户登录</h4>
                </div>
                <div class="card-body">
                    {% if form.errors %}
                    <div class="alert alert-danger">
                        <ul class="mb-0">
                            {% for field, errors in form.errors.items() %}
                                {% for error in errors %}
                                    <li>{{ error }}</li>
                                {% endfor %}
                            {% endfor %}
                        </ul>
                    </div>
                    {% endif %}
                    
                    <form method="post" action="{{ url_for('main.login') }}">
                        {{ form.hidden_tag() }}
                        <div class="mb-3">
                            {{ form.email.label(class="form-label") }}
                            {{ form.email(class="form-control") }}
                        </div>
                        <div class="mb-3">
                            {{ form.password.label(class="form-label") }}
                            {{ form.password(class="form-control") }}
                        </div>
                        <div class="mb-3 form-check">
                            {{ form.remember_me(class="form-check-input") }}
                            {{ form.remember_me.label(class="form-check-label") }}
                        </div>
                        <div class="d-grid">
                            {{ form.submit(class="btn btn-primary") }}
                        </div>
                    </form>
                    
                    <div class="mt-3 text-center">
                        <p>还没有账号？<a href="{{ url_for('main.register') }}">立即注册</a></p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 